# 1.子类方法和父类基本不同：重写此方法   例如：sleep()
# 2.子类方法是在父类方法基础上增添新功能：  例如：__init__()
# (1.)
# (2.)使用super（推荐）


class Person(object):
    def __init__(self, name, age):
        self.name = name
        self.age = age

    def sleep(self):
        print('{} is sleeping'.format(self.name))


class Student(Person):
    def __init__(self, name, age, school):
        self.school = school
        # (1.)
        # Person.__init__(self, name, age)
        # (2.)使用super
        super(Student, self).__init__(name, age)

    def sleep(self):
        print('student {} is sleeping in {}'.format(self.name, self.school))


s = Student('nFiMH', 23, 'ustc')
s.sleep()
print(s.__dict__)
